ci(security): pin claude-code-action to a commit SHA - #233
Merged
Conversation
`anthropics/claude-code-action@v1` is a mutable tag — a force-push of a compromised release would run with CLAUDE_CODE_OAUTH_TOKEN in scope. Pin both workflows to the commit the tag currently resolves to, per GitHub's third-party action hardening guidance. 787c5a0 == tag v1.0.133. Bump the SHA (and the trailing comment) together when upgrading. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pins
anthropics/claude-code-actionfrom the mutable@v1tag to the commit SHA it currently resolves to, in both Claude workflows.Why
@v1is a moving tag — if it's ever force-pushed to a compromised commit, every future run executes untrusted code withCLAUDE_CODE_OAUTH_TOKEN(andANTHROPIC_API_KEY) in scope. GitHub's hardening guide recommends pinning third-party actions to a full commit SHA.Change
in
.github/workflows/claude.ymland.github/workflows/claude-code-review.yml.787c5a0is the commitv1resolved to (= releasev1.0.133). Bump the SHA and trailing comment together on future upgrades.Context
This is the last open item from the Greptile review of #229. The other findings (write permissions, actor authorization) were already resolved by #228; this closes the remaining gap.
🤖 Generated with Claude Code
Greptile Summary
This PR hardens both Claude GitHub Actions workflows by replacing the mutable
@v1tag onanthropics/claude-code-actionwith the full commit SHA787c5a0ce96a9a6cfb050ea0c8f4c05f2447c251(verified asv1.0.133), preventing supply-chain attacks via tag force-push.claude-code-review.yml: Action pinned to full SHA; no functional change to review workflow behavior.claude.yml: Same pin applied to the interactive Claude action, which also holdsANTHROPIC_API_KEYin scope — making this the higher-risk workflow that most benefits from the fix.Confidence Score: 4/5
Safe to merge — the change is a straightforward security improvement with no functional impact.
Both workflow files correctly pin the action to the verified SHA for v1.0.133. The one remaining gap is that useblacksmith/checkout@v1 in both workflows is still a mutable tag from a third-party action, leaving a partial supply-chain exposure that this PR does not address.
Both workflow files use useblacksmith/checkout@v1 which is still an unpinned third-party action.
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A[PR or Issue Event] --> B{Workflow} B --> C[claude.yml] B --> D[claude-code-review.yml] C --> E[useblacksmith/checkout at v1 - unpinned] D --> F[useblacksmith/checkout at v1 - unpinned] E --> G[anthropics/claude-code-action at 787c5a0 - pinned] F --> H[anthropics/claude-code-action at 787c5a0 - pinned] G --> I[Secrets: CLAUDE_CODE_OAUTH_TOKEN + ANTHROPIC_API_KEY] H --> J[Secrets: CLAUDE_CODE_OAUTH_TOKEN]Comments Outside Diff (1)
.github/workflows/claude-code-review.yml, line 34 (link)useblacksmith/checkoutalso uses a mutable taguseblacksmith/checkout@v1(used in both workflows) is itself an unpinned third-party action. While it doesn't have API secrets passed to it directly, a compromisedv1tag could tamper with the checked-out source before the subsequent Claude step runs. Pinning it to a full commit SHA would make the security posture consistent across both actions in these workflows.Prompt To Fix With AI
Prompt To Fix All With AI
Reviews (1): Last reviewed commit: "ci(security): pin claude-code-action to ..." | Re-trigger Greptile